//    Copyright (C) Kherty.  All rights reserved.
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Reflection;
using OpenLS.Core.Notification;

namespace OpenLS.Spreadsheet
{
    public class CellPosition : ViewModelBase
    {
        public static implicit operator CellPosition(CellAddress address)
        {
            CellPosition result = new CellPosition();
            result.row = address.Row;
            result.column = address.Column;
            return result;
        }
        public static implicit operator CellAddress(CellPosition address)
        {
            CellAddress result = new CellAddress(address.row, address.column);
            return result;
        }

        public override int GetHashCode()
        {
            return Row << 16 + Column;
        }
        public override bool Equals(object obj)
        {
            if (obj is CellPosition)
                return Equals((CellPosition)obj);
            return false;
        }
        bool Equals(CellPosition p)
        {
            return Row == p.Row && Column == p.Column;
        }
        private int  row;

        public int  Row
        {
            get { return row; }
            set { row = value; notifyPropertyChanged("Row"); }
        }
        private int column;

        public int Column
        {
            get { return column; }
            set
            {
                column = value; notifyPropertyChanged("Column");
            }
        }
	
    }
}
